package com.eshop.config.thread;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "task.pool")
public class AsyncTaskProperties
{
    private int corePoolSize;
    private int maxPoolSize;
    private int keepAliveSeconds;
    private int queueCapacity;
    
    public int getCorePoolSize() {
        return this.corePoolSize;
    }
    
    public int getMaxPoolSize() {
        return this.maxPoolSize;
    }
    
    public int getKeepAliveSeconds() {
        return this.keepAliveSeconds;
    }
    
    public int getQueueCapacity() {
        return this.queueCapacity;
    }
    
    public void setCorePoolSize(final int corePoolSize) {
        this.corePoolSize = corePoolSize;
    }
    
    public void setMaxPoolSize(final int maxPoolSize) {
        this.maxPoolSize = maxPoolSize;
    }
    
    public void setKeepAliveSeconds(final int keepAliveSeconds) {
        this.keepAliveSeconds = keepAliveSeconds;
    }
    
    public void setQueueCapacity(final int queueCapacity) {
        this.queueCapacity = queueCapacity;
    }
    
    @Override
    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        }
        if (!(o instanceof AsyncTaskProperties)) {
            return false;
        }
        final AsyncTaskProperties other = (AsyncTaskProperties)o;
        return other.canEqual(this) && this.getCorePoolSize() == other.getCorePoolSize() && this.getMaxPoolSize() == other.getMaxPoolSize() && this.getKeepAliveSeconds() == other.getKeepAliveSeconds() && this.getQueueCapacity() == other.getQueueCapacity();
    }
    
    protected boolean canEqual(final Object other) {
        return other instanceof AsyncTaskProperties;
    }
    
    @Override
    public int hashCode() {
        final int PRIME = 59;
        int result = 1;
        result = result * 59 + this.getCorePoolSize();
        result = result * 59 + this.getMaxPoolSize();
        result = result * 59 + this.getKeepAliveSeconds();
        result = result * 59 + this.getQueueCapacity();
        return result;
    }
    
    @Override
    public String toString() {
        return "AsyncTaskProperties(corePoolSize=" + this.getCorePoolSize() + ", maxPoolSize=" + this.getMaxPoolSize() + ", keepAliveSeconds=" + this.getKeepAliveSeconds() + ", queueCapacity=" + this.getQueueCapacity() + ")";
    }
}
